package com.caesar.exer2;

import java.util.Arrays;

/**
 * @author caesar
 * @date 2025/7/16
 * @Description:
 * @apiNote
 */
public class TestEmployee {
    public static void main(String[] args) {
        Employee[] arr = new Employee[4];
        arr[0] = new Employee(1,"张三", 18000, 18);
        arr[1] = new Employee(2,"李四", 14000, 28);
        arr[2] = new Employee(3,"王五", 14000, 24);
        arr[3] = new Employee(4,"赵六", 15000, 18);

        System.out.println("排序之前：");
        for (Employee employee : arr) {
            System.out.println(employee);
        }

        Arrays.sort(arr);

        System.out.println("按照薪资排序后：");
        for (Employee employee : arr) {
            System.out.println(employee);
        }

        Arrays.sort(arr, new EmployeeAgeComparator());

        System.out.println("按照年龄排序后：");
        for (Employee employee : arr) {
            System.out.println(employee);
        }
    }
}
